
#include "ResLock.h"

ResLock::ResLock()
{
#ifdef _WIN32
	InitializeCriticalSection(&m_cs);
#else
	pthread_mutex_init(&m_cs, NULL);
#endif
}

ResLock::~ResLock()
{
#ifdef _WIN32
	DeleteCriticalSection(&m_cs);
#else
	pthread_mutex_destroy(&m_cs);
#endif
}

void ResLock::lock()
{
#ifdef _WIN32
	EnterCriticalSection(&m_cs);
#else
	pthread_mutex_lock(&m_cs);
#endif
}

void ResLock::unlock()
{
#ifdef _WIN32
	LeaveCriticalSection(&m_cs);
#else
	pthread_mutex_unlock(&m_cs);
#endif
}
